

<!-- /*用户名等信息，修改接口*/ -->
<link rel="stylesheet" href="__STATIC__/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<script src="__STATIC__/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<ul class="breadcrumb">
  <li><a href="{:U(GROUP_NAME . '/Index/index')}">首页</a> <span class="divider">/</span></li>
  <li class="active">个人资料</li>
</ul>
<h2 class="text-center">个人信息</h2>
<form id="form" method="post" action="{:U(GROUP_NAME . '/Person/updateProfileHandle')}" class="form-horizontal">
  <input type="hidden" name="u_id" value="{$profile['u_id']}" />
  <div class="control-group">
    <label class="control-label" for="inputPassword">用户名</label>
    <div class="controls">
      <input type="text" id="username" value="{$profile['username']}" name="username" placeholder="username">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputPassword">邮箱</label>
    <div class="controls">
      <input type="text" class="changeble" id="email" value="{$profile['email']}" name="email" placeholder="Email">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputPassword">qq</label>
    <div class="controls">
      <input type="text" class="changeble" id="qq" name="qq" value="{$profile['qq']}" placeholder="QQ">
    </div>
  </div>
  <div class="control-group">
    <label class="control-label">生日</label>
    <div class="controls date form_date" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
      <input size="16" type="text" id="birthday" value="{$profile['birthday']}" readonly>
      <span class="add-on"><i class="icon-remove"></i></span>
      <span class="add-on"><i class="icon-th"></i></span>
    </div>
    <input type="hidden" id="dtp_input2" name="birthday" value="{$profile['birthday']}" /><br/>
  </div>

  <div class="control-group">
      <label class="control-label" for="">注册时间</label>
      <div class="controls">
        <input type="text" value="{$profile['regtime']}">
      </div>
  </div>
  <div class="control-group">
      <label class="control-label" for="">注册IP</label>
      <div class="controls">
        <input type="text" value="{$profile['regip']}" >
      </div>
  </div>
  <div class="control-group">
    <div class="controls">
      <input type="button" class="btn" id="chan" value="change"/>
      <input type="button"  class="btn" readonly="true" style="margin-left:10px;" id="abandon" value="cancle"/>
      <!-- <button id="abandon"  type="" class="btn">confirm</button> -->
    </div>
    <div class="controls">
      
    </div>
  </div>
</form>
<script>
  $(function(){
    $('input[type=text]').each(function(){
      $(this).attr('readonly',true);
    });
    $('#abandon').click(function(){
      $('input[type=text]').each(function(){
        $(this).attr('readonly',true);
      });
      $('#chan').val('change');
      $('#abandon').attr('readonly',true);
    })
    $('#chan').click(function(){
      if($(this).val()=='change'){
        $('.changeble').each(function(){
          $(this).attr('readonly',false);
        });
        $(this).val('save');
        $('#abandon').attr('readonly',false);
      }
      else{
        if($('#email').val()&&$('#username').val()&&$('#birthday').val())
        {
           $('#form').submit();
          return false;
        }
        else
          alert('输入信息不全');
        $(this).html('change');
        
        $('#abandon').attr('readonly',false);
      }
    })
    return false;
  });

  $('.form_date').datetimepicker({
    language:  'fr',
    weekStart: 1,
    todayBtn:  1,
    autoclose: 1,
    todayHighlight: 1,
    startView: 2,
    minView: 2,
    forceParse: 0
    });
</script>